<template>
  <div id="app">
    <van-nav-bar fixed title="CreatShare在线答题"/>
    <transition name="van-fade" mode="out-in">
      <router-view></router-view>
    </transition>
    <van-tabbar v-model="active">
      <van-tabbar-item icon="shop" to="/home">题池</van-tabbar-item>
      <van-tabbar-item icon="exchange" to="/data">历史</van-tabbar-item>
      <van-tabbar-item icon="contact" to="/user">个人</van-tabbar-item>
    </van-tabbar>
  </div>
</template>

<script>
export default {
  name: 'App',
  data () {
    return {
      active: 0,
      path: ''
    }
  },
  mounted () {
    this.path = this.$route.path
    if (this.path === '/home') {
      this.active = 0
    } else if (this.path === '/data') {
      this.active = 1
    } else if (this.path === '/user') {
      this.active = 2
    }
  }
}
</script>

<style>
  .top {
    height: 46px;
  }
  .bottom {
    height: 46px;
  }
</style>
